<template>
  <div id="chooseOne" v-if="show">
    <div class="banktitle">选择行社\机构(<span>单选</span>)</div>
    <div class="bankBox" v-for="(item,index) in cities" :key="index">
      <div class="boxline">
        <span class="boxcity">{{item.cName}}</span>
      </div>
      <div class="yinhang">
        <span v-for="(ele, k) in item.list" :key="k" @click="gobank(ele)">
          {{ele.bName}}
        </span>  
      </div>
    </div>
    <div class="btnCh">
      <el-button type="primary" size="small" @click="cancel">取消</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'chooseOne',
  data () {
    return {
      show: true,
      checkAll: false,
      cities: [],
      radio: ''
    };
  },
  created() {
  },
  mounted () {
    this.getCity();
  },
  methods: {
    gobank (ele) {
      this.$router.push({path: 'targetQuery', query:{id: ele.bId, bank: ele.bName}})
    },
    getCity() {
      this.axios.get('organizationalChart/findBank')
        .then(({data}) => {
          if (data.code == 200) {
            this.cities = data.data;
          }
        })
        .catch(function (error) {
          console.log(error);
        });
    },
    cancel () {
      this.$router.go(-1);
    }
  },
  // watch: {
  //   radio (xin, old) {
  //     // this.$router.go(-1);
  //   }
  // }
};
</script>

<style lang="scss">
  #chooseOne {
    background-color: rgb(225, 226, 220);
    .banktitle {
      height: 50px;
      line-height: 50px;
      font-size: 16px;
      padding-left: 20px;
      background-color:#809092;
      border-bottom: 1px solid #ccc;
      color: white;
    }
    .bankBox {
      .boxline{
        padding: 0 20px;
        display: flex;
        justify-content: space-between;
        height: 40px;
        align-items: center;
        background-color: #F0F0F0;
      }
    }
    .yinhang {
      background-color: white;
      padding: 20px;
      padding-top: 10px;
      span {
        display: inline-block;
        padding: 5px 10px;
        border: 1px solid #cccccc;
        margin-right: 20px;
        margin-top: 10px;
        cursor: pointer;
      }
    }
    .btnCh {
      margin-top: 20px;
      padding-bottom: 20px;
      display: flex;
      justify-content: center;
      .el-button {
        margin-right: 20px;
      }
    }
  }
</style>
